package com.foryou.system.common.exception;
import com.foryou.system.common.enums.ResultEnum;

/**
 * 自定义异常
 *
 * Created by LJX
 * 2017/12/16 0016 下午 9:43
 */
public class RollbackException extends RuntimeException {
	private static final long serialVersionUID = 1L;

    private String msg;
    private int code = 500;

    public RollbackException (String msg) {
		super(msg);
		this.msg = msg;
	}

	public RollbackException(ResultEnum resultEnum){
		super(resultEnum.getMsg());
		this.msg = resultEnum.getMsg();
		this.code = resultEnum.getCode();
	}

	public RollbackException(String msg, Throwable e) {
		super(msg, e);
		this.msg = msg;
	}

	public RollbackException(String msg, int code) {
		super(msg);
		this.msg = msg;
		this.code = code;
	}

	public RollbackException(String msg, int code, Throwable e) {
		super(msg, e);
		this.msg = msg;
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}


}
